package com.yuxi.excelEntity;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.yuxi.Config.ConfigStatic;
import com.yuxi.Entity.UserTaskCompletion;
import com.yuxi.Util.StringManageUtil;

public class TaskReseachWord {
	private String inforcontext;
	private String meture;
	private String task;
	private String persons;
	private String taskTime ;
	private String souce;
	private Integer port;
	
	public Integer getPort() {
		return port;
	}
	public void setPort(Integer port) {
		this.port = port;
	}
	public String getTask() {
		return task;
	}
	public void setTask(String task) {
		this.task = task;
	}
	public String getSouce() {
		return souce;
	}
	public void setSouce(String souce) {
		this.souce = souce;
	}
	public String getInforcontext() {
		return inforcontext;
	}
	public void setInforcontext(String inforcontext) {
		this.inforcontext = inforcontext;
	}
	public String getMeture() {
		return meture;
	}
	public void setMeture(String meture) {
		this.meture = meture;
	}
	public String getPersons() {
		return persons;
	}
	public void setPersons(String persons) {
		this.persons = persons;
	}
	public String getTaskTime() {
		return taskTime;
	}
	public void setTaskTime(String taskTime) {
		this.taskTime = taskTime;
	}
	public TaskReseachWord(String souce,String inforcontext, String meture, String persons, String taskTime,String task,String port) {
		super();
		this.souce=souce;
		this.inforcontext = inforcontext;
		this.meture = meture;
		this.persons = StringManageUtil.removeDot(persons);
		this.port=Integer.parseInt(port);
		
		try{
			this.task="";
			List<UserTaskCompletion> list=new Gson().fromJson(task, new TypeToken<List<UserTaskCompletion>>(){}.getType());
			if(list!=null){
				for(int i=0;i<list.size();i++){
					UserTaskCompletion u=list.get(i);
					//SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
					//String dat1 = sdf1.format(new Date(Long.parseLong(u.getTime())));				
					this.task+=u.getName()+":"+u.getText();				
				}	
			}
		}catch(Exception e){
			this.task="";
		}
		try{
			if(ConfigStatic.LongTimeS.equals(taskTime)){
				SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
				String dat1 = sdf1.format(new Date(Long.parseLong(taskTime)));
				this.taskTime = dat1;
			}else{
				this.taskTime = "长期";
			}
		}catch(Exception e){
			this.taskTime ="";
		}
		//this.taskTime =taskTime;
	}
	
	
	@Override
	public String toString() {
		return "TaskReseachWord [inforcontext=" + inforcontext + ", meture=" + meture + ", persons=" + persons
				+ ", taskTime=" + taskTime + ", souce=" + souce + "]";
	}
	public TaskReseachWord() {
		super();
	}
}	
